﻿using MugenInjection.Logging.Interface.Components;
using MugenInjection.Logging.Modules;
using MugenInjection.Logging.NLog2.Components;

namespace MugenInjection.Logging.NLog2.Modules
{
    /// <summary>
    /// Implementation for NLog2 logger.
    /// </summary>
    public class NLogModule : LoggerModuleBase
    {
        #region Overrides of LoggerModuleBase

        /// <summary>
        /// Load bindings and components in current module. 
        /// </summary>
        public override void Load()
        {
            base.Load();
            ILoggerFactory loggerFactory;
            if (Injector.Components.TryGet(out loggerFactory) && loggerFactory is NLogFactoryComponent)
                return;
            AddComponent(new NLogFactoryComponent());
        }

        #endregion
    }
}